-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate auto-application of (non-Java-defined) methods with a single empty parameter list #8833
Deprecate auto-application of (non-Java-defined) methods with a single empty parameter list #8833
Conversation
40187f6
to
073c8ef
Compare
Is there (or could we write) a scalafix rule supporting this change? Scalafix exists for 2.13.1. |
073c8ef
to
0c40835
Compare
Let's leave this one for 2.13.3. |
|
31fbcf6
to
d51c962
Compare
d51c962
to
c78ffa1
Compare
c78ffa1
to
f6c89f7
Compare
Auto-application is dropped in Scala 3: https://dotty.epfl.ch/docs/reference/dropped-features/auto-apply.html So it must be deprecated in 2.13 first. Also, AFAICT Object_clone is Java-defined: $ qscala Welcome to Scala 2.13.2-20200325-150327-bc1cad4 (OpenJDK 64-Bit Server VM, Java 11.0.6). Type in expressions for evaluation. Or try :help. scala> :power Power mode enabled. :phase is at typer. import scala.tools.nsc._, intp.global._, definitions._ Try :help or completions for vals._ and power._ scala> Object_clone.isJavaDefined val res0: Boolean = true
f6c89f7
to
c900df8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
force-pushed to bump the deprecated-since from 2.13.2 to 2.13.3. let's merge as soon as CI likes it again
Auto-application is dropped in Scala 3:
https://dotty.epfl.ch/docs/reference/dropped-features/auto-apply.html
So it must be deprecated in 2.13 first.
Strongly related to deprecating overriding nullary (and the inverse, overriding nilary): #8846.
Example
How to fix
It is recommended to add the missing parens:
The change can be made manually or by using scala-rewrites'
ExplicitNonNullaryApply
.How to suppress
Since 2.13.2, Scala offers
-Wconf:...
and@nowarn
for warning suppression. You can suppress the new warning globally by passing-Wconf:cat=deprecation&msg=Auto-application:silent
to the compiler, or you can suppress it locally by adding@nowarn("cat=deprecation&msg=Auto-application")
at the call site.